const Koa = require("koa");
const app = new Koa();
const Router = require("@koa/router");
const router = new Router();

router.get("/formio/select/options", function(ctx, next) {
  ctx.body = {
    options: [
      {
        label: "选项1",
        value: "1"
      }, {
        label: "选项2",
        value: "2"
      }, {
        label: "选项3",
        value: "3"
      }
    ]
  };
});

router.get("/formio/select/options1", function(ctx, next) {
    ctx.body =  [
        {
            label: "选项1",
            value: "1"
        }, {
            label: "选项2",
            value: "2"
        }, {
            label: "选项3",
            value: "3"
        }
    ];
});

app.use(router.routes())
  .use(router.allowedMethods());

console.log("Starting server on port 3000");

app.on("error", (err, ctx) => {
  console.error("server error", err);
});

app.listen(3000);
